package pro.softzhang.algo.lc200;

import pro.softzhang.algo.flag.knowledge.KBinarySearch;

/**
 * 278. 第一个错误版本 https://leetcode.cn/problems/first-bad-version/description/
 */
public class LC278_FirstBadVersion {
    public static void main(String[] args) {

    }

    @KBinarySearch
    static
    class Solution {
        public int firstBadVersion(int n) {
            int left = 1, right = n;
            while (left < right) {
                int mid = left + (right - left) / 2;
                if (isBadVersion(mid)) {
                    right = mid;
                } else {
                    left = mid + 1;
                }
            }
            return left;
        }

        public boolean isBadVersion(int mid) {
            return true;
        }
    }
}
